package com.ayu.shortlink.settlement.controller;

import com.ayu.shortlink.settlement.common.convention.result.Result;
import com.ayu.shortlink.settlement.common.convention.result.Results;
import com.ayu.shortlink.settlement.dto.req.UserCouponPageQueryReqDTO;
import com.ayu.shortlink.settlement.dto.resp.UserCouponPageQueryRespDTO;
import com.ayu.shortlink.settlement.service.UserCouponQueryService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 查看可用
 */
@RestController
@RequiredArgsConstructor
public class UserCouponQueryController {
    private final UserCouponQueryService couponQueryService;

    /**
     * 查询用户有效的优惠券
     */
    @GetMapping("/api/short-link/settlement/v1/user-coupon/effective")
    public Result<IPage<UserCouponPageQueryRespDTO>> pageEffectiveUserCoupon(UserCouponPageQueryReqDTO requestParam){
        return Results.success(couponQueryService.pageEffectiveUserCoupon(requestParam));
    }

    /**
     * 查询用户无效的优惠券
     */
    @GetMapping("/api/short-link/settlement/v1/user-coupon/invalid")
    public Result<IPage<UserCouponPageQueryRespDTO>> pageInvalidUserCoupon(UserCouponPageQueryReqDTO requestParam){
        return Results.success(couponQueryService.pageInvalidUserCoupon(requestParam));
    }
}
